<% layout('/layouts/default.html', {title: '任务部署信息表(主)管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<#form:form id="searchForm" model="${dcSupTaskInfo}" action="${ctx}/taskdeploy/dcSupTaskInfo/queryDeleteListData" method="post" class="form-inline"
			data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
			<div style="float: right">
				<div class="form-group">
					<div class="control-inline width-160">
						<#form:input path="taskTitle" maxlength="200" class="form-control width-160" placeholder="请输入任务标题"/>
					</div>
					<div class="control-inline width-160">
						<#form:input path="messageNumber" maxlength="200" class="form-control width-160" placeholder="请输入督办字号"/>
					</div>
					<div class="control-inline width-160">
						<#form:input path="taskContent" maxlength="200" class="form-control width-160" placeholder="请输入任务内容"/>
					</div>
				</div>

				<div class="form-group" >
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button onclick="cz();" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</div>
		</#form:form>
	</div>
	<div style="color: red">&emsp;删除的表包含任务表dc_sup_task_info,分发表dc_sup_task_action,dc_sup_task_info_add,反馈表dc_sup_task_feedback,审核表dc_sup_task_audit,待办表dc_sup_backlog</div>
	<div style="color: red">&emsp;数据删除无法恢复,谨慎操作</div>
	<div class="box-body">
		<table id="dataGrid"></table>
		<div id="dataGridPage"></div>
	</div>
</div>
</div>
<% } %>
<script>
	//重置
	function cz(){
		searchForm.reset();
		$('#dataGrid').dataGrid('reloadGrid');
	}

	// 初始化DataGrid对象
	$('#dataGrid').dataGrid({
		searchForm: $("#searchForm"),
		sortableColumn: false, // 列表不允许排序
		columnModel: [
			{header:'${text("主键")}', name:'id', index:'a.id', width:100, align:"left",},
			{header:'${text("督办字号")}', name:'messageNumber', index:'a.message_number', width:120, align:"left"},
			{header:'${text("任务标题")}', name:'taskTitle', index:'a.task_title', width:150, align:"left"
				, formatter: function(val, obj, row, act){
						return '<a href="${ctx}/action/dcSupTaskAction/listOrgDelete?taskId='+row.id+'" class="btnList" data-title="${text("牵头单位删除")}">'+(val||'暂无标题')+'</a>';
				}
			},
			{header:'${text("任务类型")}', name:'taskTypeName', index:'a.task_type_name', width:150, align:"left"},
			{header:'${text("任务内容")}', name:'taskContent', index:'a.task_content', width:150, align:"left", formatter: function(val, obj, row, act){
					return '<a href="${ctx}/taskdeploy/dcSupTaskInfo/detailForm?id='+row.id+'" class="btnList" data-title="${text("督办任务信息")}">'+(val||'暂无内容')+'</a>';
				}},
			{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', width:100, align:"left"},
			{header:'${text("任务状态")}', name:'taskStatus', index:'a.task_status', width:100, align:"center"
				,formatter: function(val, obj, row, act){
					return js.getDictLabel(${@DictUtils.getDictListJson('dc_task_status')}, val, '${text("未知")}', true);
				}},
			{header:'${text("操作")}', name:'actions', width:220, align:"center",formatter: function(val, obj, row, act){
					var actions = [];
					if(row.normalFlag=='2'){
						actions.push('<a href="#" onclick=showTaskLeaderOrg("' + row.id + '")  class="btn btn-primary btn-xs" title="${text("追加牵头单位")}"><span>追加单位</span></a>&emsp;');
					}
					actions.push('<a href="${ctx}/taskdeploy/dcSupTaskInfo/editAllInfo?id=' + row.id + '" class="btn btn-primary btn-xs btnList" title="${text("内容修改")}"><span>内容修改</span></a>&emsp;');
					actions.push('<a href="${ctx}/taskdeploy/dcSupTaskInfo/deleteAll?id='+row.id+'" class="btn btn-danger btn-xs btnList" title="${text("删除任务")}" data-confirm="${text("确认要彻底删除该任务吗？")}">删除</a>&nbsp;');
					return actions.join('');
				}}
		],
		// 加载成功后执行事件
		ajaxSuccess: function(data){

		}
	});
	function showTaskLeaderOrg(taskNo) {
		js.layer.open({
			type: 2,
			title: '牵头责任单位',
			area: ['700px', '500px'],
			content: "${ctx}/taskdeploy/dcSupTaskInfo/showTaskLeaderOrg?taskNo=" + taskNo,
			btn: [],
			btn1: function (index, layero) {

			}
		});
	}
</script>